package loader.servlet;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import loader.remover.Remover;

public class RemoverServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;
	private Remover remover;
	/**
	 * Constructor of the object.
	 */
	public RemoverServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		this.remover.close();
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {

		String sdelay = this.getServletContext().getInitParameter("rdelay");
		String shour = this.getServletContext().getInitParameter("rhour");
		int delay = Integer.parseInt(sdelay);
		int hour = Integer.parseInt(shour);
		remover = new Remover();
		remover.remove("deal", delay, hour);
	}

}
